package com.yeban.bams.server.manager;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @Desc 登录信息类
 * @Author yeban
 * @Date 2025/11/9
 */
public class LoginInfo {

    private final String ip;
    private final Long accId;
    private final LocalDateTime loginTime ;
    private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

    public LoginInfo(String ip, Long accId) {
        this.ip = ip;
        this.accId = accId;
        this.loginTime = LocalDateTime.now();
    }

    public String getIp() {
        return ip;
    }

    public Long getAccId() {
        return accId;
    }

    public LocalDateTime getLoginTime() {
        return loginTime;
    }

    public String getDisplayTime() {
        return loginTime.format(formatter);
    }

    public String toString() {
        return "LoginInfo{ip = " + ip + ", accId = " + accId + ", loginTime = " + loginTime + ", formatter = " + formatter + "}";
    }
}
